<?php

declare(strict_types=1);

namespace App\CustHub\Model;

use Mine\MineModel;

/**
 * @property int $id 
 * @property int $uid 
 * @property int $main_uid 主账号Id
 * @property string $mobile 手机号
 * @property array $corp_tags 企业标签
 * @property array $smart_tags 智能标签
 * @property int $status 打招呼状态：0=待分配 1=已完成 2=已失败  3=已分配
 * @property string $user_id 用户ID
 * @property int $wechat_status 微信状态： 0=待处理 1=待通过 2=已通过 3=已失败  4-未搜到联系人
 * @property int $contact_id 客户ID
 * @property string $content 话术
 * @property int $add_robot_id 打招呼机器人ID
 * @property string $add_time 打招呼时间
 * @property string $next_add_time 下次打招呼时间
 * @property int $add_number 添加次数
 * @property string $pass_time 通过时间
 * @property int $group_id 分组ID
 * @property int $send_status 是否已经发送邀请
 * @property string $union_id 
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 * @property-read null|ChAddFriendRobot $addFriendRobot 
 */
class ChAddFriend extends MineModel
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ch_add_friend';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'uid', 'main_uid', 'mobile', 'corp_tags', 'smart_tags', 'status', 'user_id', 'wechat_status', 'contact_id', 'content', 'add_robot_id', 'add_time', 'next_add_time', 'add_number', 'pass_time', 'group_id', 'send_status', 'union_id', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'uid' => 'integer', 'main_uid' => 'integer', 'corp_tags' => 'array', 'smart_tags' => 'array', 'status' => 'integer', 'wechat_status' => 'integer', 'contact_id' => 'integer', 'add_robot_id' => 'integer', 'add_number' => 'integer', 'group_id' => 'integer', 'send_status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function addFriendRobot()
    {
        return $this->belongsTo(ChAddFriendRobot::class, 'add_robot_id', 'id');
    }
}
